//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __CVARIABLEOFASTRINGBUF_H__
#define __CVARIABLEOFASTRINGBUF_H__

#include <elastos.h>

_ELASTOS_NAMESPACE_USING

class CVariableOfAStringBuf  : public IVariableOfAStringBuf,
                                  public IAStringBufSetter,
                                  public IAStringBufGetter
{
public:
    CARAPI_(PInterface) Probe(REIID riid);
    CARAPI_(UInt32) AddRef();
    CARAPI_(UInt32) Release();
    CARAPI Aggregate(AggregateType type, PInterface pObj);
    CARAPI GetDomain(PInterface *ppObj);

    CARAPI GetTypeInfo(
        /* [out] */ IDataTypeInfo ** ppTypeInfo);

    CARAPI GetPayload(
        /* [out] */ PVoid * pPayload);

    CARAPI Rebox(
        /* [in] */ PVoid localVariablePtr);

    CARAPI GetSetter(
        /* [out] */ IAStringBufSetter ** ppSetter);

    CARAPI GetGetter(
        /* [out] */ IAStringBufGetter ** ppGetter);

    CARAPI SetElement(
        /* [in] */ Int32 index,
        /* [in] */ AChar character);

    CARAPI SetData(
        /* [in] */ AString astr);

    CARAPI GetCapacity(
        /* [out] */ Int32 * pCapacity);

    CARAPI GetLength(
        /* [out] */ Int32 * pLength);

    CARAPI GetElement(
        /* [in] */ Int32 index,
        /* [out] */ AChar * pAch);

    CARAPI GetData(
        /* [out] */ AStringBuf * asBuf);

    CVariableOfAStringBuf(
        /* [in] */ PAStringBuf pAsb,
        /* [in] */ Boolean bAlloc);

    virtual ~CVariableOfAStringBuf();

private:
    PAStringBuf     m_pAsb;
    Boolean         m_bAlloc;

    Interlocked m_cRef;
};

#endif // __CVARIABLEOFASTRINGBUF_H__
